import 'babel-polyfill'
import 'core-js'
import Vue from 'vue'
import App from '@/App'
import router from '@/router'
import store from '@/store'
import VueCookie from 'vue-cookie'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/scss/index.scss'
import httpRequest from '@/utils/httpRequest'
import dictUtils from '@/utils/dictUtils'
import varUtils from '@/utils/varUtils'
import utils from '@/utils'
import '@/utils/filter'
import '@/utils/directive'
import validator from '@/utils/validator'
import cloneDeep from 'lodash/cloneDeep'
import lodash from 'lodash/object'
import moment from 'moment'
import 'font-awesome/css/font-awesome.min.css'
import VCharts from 'v-charts'
import './directive'
import TimeSelect from '@/components/formEle/index'

// 全局变量
import Global from './utils/global'
// 提示弹窗组件
import Msg from '@/components/message/main'

// 消息提示2
import message2 from '@/components/message/index.js'
// Vue.use(VueEditor)
// Vue.use(FormMaking)
// import VuethousandthInput from 'vue-thousandth-input'

// Vue.use(VuethousandthInput)
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/swiper-bundle.min.css'
/* 封装好的接口文件 */
import api from './api/ygb'
import Swiper2, {
    Navigation,
    Pagination,
    EffectFade,
    Autoplay
} from 'swiper'
// 引入vue-amap
import VueAMap from 'vue-amap'

Vue.prototype.$api = api
Vue.use(TimeSelect)
Vue.use(message2)
Vue.use(VueAwesomeSwiper)
Swiper2.use([Navigation, Pagination, EffectFade, Autoplay])
Vue.use(VCharts)
Vue.use(VueCookie)
Vue.use(ElementUI)
Vue.use(Msg)
Vue.use(VueAMap)
Vue.config.productionTip = false
// 挂载全局
Vue.prototype.$http = httpRequest // ajax请求方法
Vue.prototype.hasPermission = utils.hasPermission // 权限方法
Vue.prototype.treeDataTranslate = utils.treeDataTranslate // 树形数据转换
Vue.prototype.$utils = utils
// 千分位转换
Vue.prototype.formatIntSalary = function (num) {
    num += ''
    if (!num.includes('.')) num += '.'
    return num.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
        return $1 + ','
    }).replace(/\.$/, '')
}
Vue.prototype.$window = window
Vue.prototype.$dictUtils = dictUtils
Vue.prototype.$varUtils = varUtils
Vue.prototype.recover = utils.recover
Vue.prototype.recoverNotNull = utils.recoverNotNull
Vue.prototype.validator = validator
Vue.prototype.lodash = lodash
Vue.prototype.moment = moment
Vue.prototype.deepClone = utils.deepClone
Vue.prototype.validatenull = utils.validatenull
Vue.prototype.$events = new Vue()
Vue.prototype.GLOBAL = Global
utils.printLogo()

// 初始化vue-amap
VueAMap.initAMapApiLoader({
    // 高德的key
    key: 'fc7af217181130098784f41a43bbe755',
    // 插件集合
    plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
    // 高德 sdk 版本，默认为 1.4.4
    v: '1.4.4'
})

// 保存整站vuex本地储存初始状态
window.SITE_CONFIG = {}
window.SITE_CONFIG['storeState'] = cloneDeep(store.state)

/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App)
})
